#include <stdio.h>

int res[10000] = {0};
int cnt = 0;

int main()
{
    int n = 0;
    scanf("%d", &n);
    while (n > 1)
    {
        res[cnt++] = n;
        if (n & 0x1)
        {
            n *= 3;
            n += 1;
        }
        else
        {
            n >>= 1;
        }
    }
    res[cnt++] = 1;
    for (int *i = res + cnt - 1; i > res - 1; --i)
    {
        printf("%d ", *i);
    }
    return 0;
}